//开票类型
var billing_type = [
                       { id: 'bill', value: 'bill', text: '汇票' },
                       { id: 'cashier', value: 'cashier', text: '本票' },
                       { id: 'Check', value: 'Check', text: '支票' }
                   ];
 //开票类型
var customerNature = [
                       { id: 'personage', value: 'personage', text: '个人' },
                       { id: 'company', value: 'company', text: '企业' }
                   ];
//是否选择                   
 var bool_data = [
                 { id: '1', value: '1', text: '是' },
                 { id: '0', value: '0', text: '否' }
             ];
 
 var true_false_data =[
 				{ id:'1',value:'true',text:'是'},
 				{ id:'0',value:'false',text:'否'}
 ];
 
 var supplier_nature_data = [
 					{id:'supplier',value:'supplier',text:'供货方'},
 					{id:'logistics',value:'logistics',text:'物流方'}];
//保质期单位             
var shelf_life_unit = [
                 { id: 'year', value: 'year', text: '年' },
                 { id: 'quarter', value: 'quarter', text: '季度' },
                 { id: 'month', value: 'month', text: '月' },
                 { id: 'week', value: 'week', text: '星期' },
                 { id: 'day', value: 'day', text: '天' },
                 { id: 'hour', value: 'hour', text: '小时' }
             ];
//单据状态
function getStatsSelect(){
		//单据状态
	   var statuData = [
          { id: '1', value: '1', text: '新增' },
          { id: '2', value: '2', text: '保存' },
          { id: '3', value: '3', text: '提交' },
          { id: '4', value: '4', text: '审核' }
	      ];
	   return  statuData; 
 };
 
 //采购业务类型
 function getPurBizTypeSelect(){
	   var bizType = [
           { id: 'out', value: 'out', text: '退库' },
           { id: 'input', value: 'input', text: '入库' }
	      ];
	   return  bizType; 
  };
  
  //途损处理方式
  function getLossTypeSelect(){
	   var lossType = [
            { id: 'wlf', value: 'wlf', text: '物流方承担' },
            { id: 'khf', value: 'khf', text: '客户方承担' },
            { id: 'ghf', value: 'ghf', text: '供货方承担' },
            { id: 'other', value: 'other', text: '其他' }
	      ];
	   return  lossType; 
   };
   
   /**
    * 销售类型
    */
   function getDeliveryWaySelect(){
	   var deliveryWay = [
	         { id: 'fayun', value: 'fayun', text: '发运' },
	         { id: 'ziti', value: 'ziti', text: '自提' }
	       ];
	   return deliveryWay;
   }
   
   /**
    * 
    * @returns {Array}
    */
   function getDifferenceWaySelect(){
	   var differenceWay = [
	       {id:'bcl' ,value:'bcl' ,text:'不处理'},
	       {id:'rk' ,value:'rk' ,text:'入库'},
	       {id:'ck' ,value:'ck' ,text:'出库'}
	      ];
	   return differenceWay;
   }
   
   /**
    * 业务类型
    */
   function getBizTypeSelect(){
	   var bizType = [
	         { id: 'rk', value: 'rk', text: '入库' },
	         { id: 'tk', value: 'tk', text: '出库' }
	       ];
	   return bizType;
   }

   
  function getCombobxTextByValue(arr,value,valueField,textField){
  	if(!arr || arr.length==0 || typeof(value)=='undefined'){
  		return null;
  	}else{
  		if(!valueField){
  			valueField = "value";
  		}
  		if(!textField){
  		 textField = "text";
  		}
  		for(var i=0;i<arr.length;i++){
  			if(arr[i][valueField] == value){
  				return arr[i][textField];
  			}
  		}
  	}
  }
  
  function getTrueFlaseText(arr,trueorfalse,valueField,textField){
  	var value ="";
  	if(trueorfalse==false){
  		value="0";
  	}else if(trueorfalse == true){
  		value="1";
  	}else{
  		console.error("参数异常: "+trueorfalse);
  		return;
  	}
  	if(!arr || arr.length==0 || typeof(value)=='undefined'){
  		return null;
  	}else{
  		if(!valueField){
  			valueField = "value";
  		}
  		if(!textField){
  		 textField = "text";
  		}
  		for(var i=0;i<arr.length;i++){
  			if(arr[i][valueField] == value){
  				return arr[i][textField];
  			}
  		}
  	}
  
  }


